import { request } from '@boeyo/portal';

/**
 * 测点列表
 * null
 */
export const fetchList = (params) => {
  return request({
    url: '/measuring/list',
    params,
  });
};

/**
 * 测点详情
 * null
 */
export const fetchDetail = (id) => {
  return request({
    url: `/measuring/detail/${id}`,
    method: 'POST',
  });
};

/**
 * 新增测点
 * null
 */
export const createMeasure = (data) => {
  return request({
    url: '/measuring/add',
    method: 'POST',
    data,
  });
};

/**
 * 监测列表类型分类
 * null
 */
export const fetchMonitorList = (data) => {
  return request({
    url: '/monitoring/list',
    method: 'POST',
    data,
  });
};

/**
 * 监测列表树形列表
 * null
 */
export const fetchStructureTree = (data = {}) => {
  return request({
    url: '/monitoring/tree',
    method: 'POST',
    data,
  });
};

/**
 * 项目下拉列表
 * @ss.hasPermi('manufacturer:selectList')
 */
export const projectSelectList = () => {
  return request({
    url: 'project/selectList',
    method: 'GET',
  });
};

/**
 * 设备列表
 * null
 */
export const fetchDevices = (params = {}) => {
  return request({
    url: '/measuring/devices',
    method: 'GET',
    params,
  });
};

/**
 * 测点历史数据打包下载
 * null
 */
export const downloadFile = (data) => {
  return request({
    url: '/measuring/pointDownload',
    method: 'POST',
    responseType: 'blob',
    data,
  });
};
